package druid;


import com.alibaba.druid.pool.DruidDataSourceFactory;

import javax.sql.DataSource;
import java.io.InputStream;
import java.sql.Connection;
import java.util.Properties;

public class DruidDemo01 {
    public static void main(String[] args) throws Exception {
            // 导入jar包
           // 定义配置文件  druid.properties
        //加载配置文件druid.properties
        Properties aa= new Properties();
        InputStream bb = DruidDemo01.class.getClassLoader().getResourceAsStream("druid.properties");
        aa.load(bb);
        //获取连接池对象
        DataSource cc = DruidDataSourceFactory.createDataSource(aa);
        //获取连接
        Connection dd = cc.getConnection();
        System.out.println(dd);
    }
}
